﻿using Microsoft.AspNetCore.Components.WebView.Wpf;
using Microsoft.Extensions.DependencyInjection;
using LaserMark.ViewModels;
using LaserMark.Components;
using System.Windows;

namespace LaserMark.Views
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        /// <summary>
        ///
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();
            this.DataContext = ((IServiceProvider)App.Current.FindResource("services")).GetRequiredService<InitViewModel>();
            
            WebView.RootComponents.Add(new RootComponent()
            {
                ComponentType = typeof(Main),
                Selector = "#app"
            });
        }

        private void WebView_WebMessageReceived(object? sender, Microsoft.Web.WebView2.Core.CoreWebView2WebMessageReceivedEventArgs e)
        {

        }

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
        }
    }
}
